<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
    <!-- Constants -->
    <constant name="struts.devMode" value="true"/>
    <constant name="struts.i18n.encoding" value="UTF-8"/>
    <constant  name="struts.i18n.reload" value="false" />
    <constant name="struts.action.extension" value="jhtml"/>
    <constant name="struts.objectFactory" value="spring"/>
    <constant name="struts.custom.i18n.resources" value="ApplicationResources,errors"/>
    <constant name="struts.multipart.maxSize" value="2097152"/>
    <constant name="struts.ui.theme" value="css_xhtml"/>
    <constant name="struts.codebehind.pathPrefix" value="${pathPrefix}/"/>
    <constant name="struts.enable.SlashesInActionNames" value="true"/>
    <constant name="struts.configuration.xml.reload" value="false" />
    <constant name="struts.action.extension" value="action,," />
    <constant name="struts.codebehind.defaultPackage" value="${packageName}" />
    <constant name="struts.serve.static" value="true" />
    <constant name="struts.serve.static.browserCache" value="false" />
    <!--<constant name="struts.freemarker.manager.classname" value="customFreemarkerManager" /> -->

    <!-- Actions in this package will be prefixed with /default/ -->
    <package name="${packageName}" extends="struts-default" namespace="/${packageName}">
      
        <global-results>
            <result name="noPage" type="freemarker">/gloabErrorsPage.ftl</result>
        </global-results>
        
        <global-exception-mappings>
            <exception-mapping exception="java.lang.NumberFormatException" result="noPage"/>
            <exception-mapping exception="java.lang.Exception" result="noPage"/>
        </global-exception-mappings> 
        
       <#list beans as action>
       <!-- base on  ${action.beanName?uncap_first} -->
         <action  name="create${action.baseAlias?cap_first}" class="${action.beanName?uncap_first}" method="create" >
           <result name="success" type="freemarker">${pathPrefix}/${packageName}/${genRule.genNameByType(action.baseAlias,"createPage")?uncap_first}</result>
           <result name="input" type="freemarker">${pathPrefix}/${packageName}/${genRule.genNameByType(action.baseAlias,"createPage")?uncap_first}</result>
         </action>
         <action  name="list${action.baseAlias?cap_first}" class="${action.beanName?uncap_first}" method="list" >
           <result name="success" type="freemarker">${pathPrefix}/${packageName}/${genRule.genNameByType(action.baseAlias,"listPage")?uncap_first}</result>
           <result name="input" type="freemarker">${pathPrefix}/${packageName}/${genRule.genNameByType(action.baseAlias,"createPage")?uncap_first}</result>
         </action>
         <action  name="get${action.baseAlias?cap_first}" class="${action.beanName?uncap_first}" method="get" >
           <result name="success" type="freemarker">${pathPrefix}/${packageName}/${genRule.genNameByType(action.baseAlias,"getPage")?uncap_first}</result>
           <result name="input" type="freemarker">${pathPrefix}/${packageName}/${genRule.genNameByType(action.baseAlias,"createPage")?uncap_first}</result>
           </action> 
         <action  name="update${action.baseAlias?cap_first}" class="${action.beanName?uncap_first}" method="update" >
           <result name="success" type="freemarker">${pathPrefix}/${packageName}/${genRule.genNameByType(action.baseAlias,"updatePage")?uncap_first}</result>
           <result name="input" type="freemarker">${pathPrefix}/${packageName}/${genRule.genNameByType(action.baseAlias,"createPage")?uncap_first}</result>
         </action>
         <action  name="delete${action.baseAlias?cap_first}" class="${action.beanName?uncap_first}" method="delete" >
           <result name="success" type="redirectAction">list${action.baseAlias?cap_first}</result>
           <result name="input" type="redirectAction">list${action.baseAlias?cap_first}</result>
         </action>
       </#list> 
    </package>
    
</struts>
